package com.opencart.web.bindingInitializer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.context.request.WebRequest;

import com.opencart.domain.Category;
import com.opencart.service.CategoryService;
import com.opencart.web.propertyEditor.CategoryEditor;

public class CategoryBindingInitializer implements WebBindingInitializer {
	private CategoryService categoryService;

	@Autowired
	public CategoryBindingInitializer(CategoryService categoryService) {
		this.categoryService = categoryService;
	}

	public void initBinder(WebDataBinder binder, WebRequest request) {
		binder.registerCustomEditor(Category.class, new CategoryEditor(
				categoryService));
	}

}
